﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace FuturamaPDA {
	public class Logger {
		private static Logger instance;
		private String logMessage;
		private String logfilePath;
		private StreamWriter writer;

		private Logger() {
			this.logfilePath = "Program Files\\futuramapda\\log.txt";
			if(File.Exists(logfilePath)) {
				File.Delete(logfilePath);
			}
		}

		public static Logger Instance {
			get {
				if (instance == null) {
					instance = new Logger();
				}
				return instance;
			}
		}

		public void writeLog(String logMessage) {
			this.logMessage = logMessage;
			this.writer = File.AppendText(logfilePath);

			this.writer.WriteLine("{0}", logMessage);
			this.writer.WriteLine("-------------------------------");

			this.writer.Flush();
			this.writer.Close();

		}
	}
}
